/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EL;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author Tian
 */
@Embeddable
public class OrderDetailsPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "orderID")
    private String orderID;
    @Basic(optional = false)
    @Column(name = "foodID")
    private int foodID;

    public OrderDetailsPK()
    {
    }

    public OrderDetailsPK(String orderID, int foodID)
    {
        this.orderID = orderID;
        this.foodID = foodID;
    }

    public String getOrderID()
    {
        return orderID;
    }

    public void setOrderID(String orderID)
    {
        this.orderID = orderID;
    }

    public int getFoodID()
    {
        return foodID;
    }

    public void setFoodID(int foodID)
    {
        this.foodID = foodID;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (orderID != null ? orderID.hashCode() : 0);
        hash += (int) foodID;
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrderDetailsPK))
        {
            return false;
        }
        OrderDetailsPK other = (OrderDetailsPK) object;
        if ((this.orderID == null && other.orderID != null) || (this.orderID != null && !this.orderID.equals(other.orderID)))
        {
            return false;
        }
        if (this.foodID != other.foodID)
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "EL.OrderDetailsPK[orderID=" + orderID + ", foodID=" + foodID + "]";
    }

}
